{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0eb84e40",
   "metadata": {},
   "source": [
    "---------\n",
    "* 2022/9/5/week03\n",
    "* Pthon学习记录\n",
    "* 记录人： 江柯廷\n",
    "---------"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dc2c4916",
   "metadata": {},
   "source": [
    "# 本周学习目标\n",
    "> 1.模块\n",
    "\n",
    "> 2.变量\n",
    "\n",
    "> 3.循环遍历"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "115ea677",
   "metadata": {},
   "source": [
    "# 1.模块（标准库）\n",
    "- python创始人团队为后面使用这门编程语言的人们提供的解决日常生活可能使用到的功能，而制作的可以方便使用的模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "2c82874b",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "5b2a24d9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1662345943.2560234"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 纪元（1970.1.1）\n",
    "# 时间戳\n",
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "9c14aabe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1662346065.0228682"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "bf0afee1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=8, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "0380b258",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=5, tm_hour=2, tm_min=53, tm_sec=30, tm_wday=0, tm_yday=248, tm_isdst=0)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.gmtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "2cf273e3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Mon Sep  5 11:01:58 2022'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.asctime(time.localtime())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "759ac8bd",
   "metadata": {},
   "source": [
    "## 2.模块（开源模块）\n",
    "- 1.因为代码开源\n",
    "- 2.集合全领域（全人类）的需求\n",
    "- 3.按照国际标准开放的模块库\n",
    "> [资源地址](http."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1c06ea00",
   "metadata": {},
   "source": [
    "## 1.3模块（自定义模块）\n",
    "> 1.不愿意开源的有一定知识产权的（开放API租用形式开发）\n",
    "\n",
    "> 2.自己用的,写的也不怎么好的,开源出去丢人的"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4f0ad7af",
   "metadata": {},
   "source": [
    "# 2.变量\n",
    "> 变量名规则\n",
    "\n",
    ">> 1.变量名只能是 字母\\数字\\下划线的任意组合\n",
    "\n",
    ">> 2.变量名的第一个字母不能是数字\n",
    "\n",
    ">> 3.在显示绿色的不能为变量名"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "132238c8",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三_01 = \"Xiao Hong\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "3d39e6e6",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三_01_age = 19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "5d1c7c6f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "19"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网三_01_age"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "c32fe5bd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1522659953136"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id(网三_01)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3cdf1c72",
   "metadata": {},
   "source": [
    "# 课后作业\n",
    "* 1.课本p4项目练习(写一遍运行成功)\n",
    "* 2.思考if是什么?\n",
    "* 3.思考from是什么"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "05b2e567",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'odds' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [1]\u001b[0m, in \u001b[0;36m<cell line: 4>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      2\u001b[0m adds \u001b[38;5;241m=\u001b[39m [\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m2\u001b[39m,\u001b[38;5;241m5\u001b[39m,\u001b[38;5;241m7\u001b[39m,\u001b[38;5;241m9\u001b[39m,\u001b[38;5;241m11\u001b[39m,\u001b[38;5;241m13\u001b[39m,\u001b[38;5;241m15\u001b[39m,\u001b[38;5;241m17\u001b[39m,\u001b[38;5;241m19\u001b[39m,\u001b[38;5;241m21\u001b[39m,\u001b[38;5;241m23\u001b[39m,\u001b[38;5;241m25\u001b[39m,\u001b[38;5;241m27\u001b[39m,\u001b[38;5;241m29\u001b[39m,\u001b[38;5;241m31\u001b[39m,\u001b[38;5;241m33\u001b[39m,\u001b[38;5;241m35\u001b[39m,\u001b[38;5;241m37\u001b[39m,\u001b[38;5;241m39\u001b[39m,\u001b[38;5;241m41\u001b[39m,\u001b[38;5;241m43\u001b[39m,\u001b[38;5;241m45\u001b[39m,\u001b[38;5;241m47\u001b[39m,\u001b[38;5;241m49\u001b[39m,\u001b[38;5;241m51\u001b[39m,\u001b[38;5;241m53\u001b[39m,\u001b[38;5;241m55\u001b[39m,\u001b[38;5;241m57\u001b[39m,\u001b[38;5;241m59\u001b[39m]\n\u001b[0;32m      3\u001b[0m right_this_minute \u001b[38;5;241m=\u001b[39m datetime\u001b[38;5;241m.\u001b[39mtoday()\u001b[38;5;241m.\u001b[39mminute\n\u001b[1;32m----> 4\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m right_this_minute \u001b[38;5;129;01min\u001b[39;00m \u001b[43modds\u001b[49m:\n\u001b[0;32m      5\u001b[0m     \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mThis minute seems a little odd.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m      6\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
      "\u001b[1;31mNameError\u001b[0m: name 'odds' is not defined"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "adds = [1,2,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59]\n",
    "right_this_minute = datetime.today().minute\n",
    "if right_this_minute in odds:\n",
    "    print(\"This minute seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an oodd minute.\")\n",
    "    "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
